﻿using System;
using System.Diagnostics.Contracts;

namespace OpenLS.Spreadsheet.UI.Internals
{
    internal struct HorizontalBounds
    {
        private readonly double _max;
        private readonly double _min;

        public HorizontalBounds(double min, double max)
        {
            Contract.Requires(min >= 0);
            Contract.Requires(max >= min);
            _max = max;
            _min = min;
        }

        public double Width
        {
            get { return _max - _min; }
        }

        public double Min
        {
            get { return _min; }
        }

        public double Max
        {
            get { return _max; }
        }

        public HorizontalBounds Offset(double d)
        {
            return new HorizontalBounds(Min + d, Max + d);
        }
    }
}